﻿import Vue from 'vue'
import VueRouter from 'vue-router'

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}

/* 管理员界面路由
修改人：张家豪
时间：2020/6/23 */
const Login = () => import('../views/login/Login.vue')
const Admin = () => import('../views/manager/admin.vue')
const Test = () => import('../views/manager/test.vue')
const classmanager = () => import('../views/manager/class_manager/classmanager.vue')
const classapply = () => import('../views/manager/class_apply/classapply.vue')
const usercontrol = () => import('../views/manager/user_control/usercontrol.vue')
const student_infor = () => import('../views/information/student_infor.vue')
const teacher_infor = () => import('../views/information/teacher_infor.vue')
const alter_password = () => import('../views/information/alter_password.vue')
const teacher_alter = () => import('../views/information/alter_password.vue')
const class_check = () => import('../views/student/student_class/class_check.vue')
const class_content = () => import('../views/student/student_class/class_infor/class_content.vue')
const class_discuss = () => import('../views/student/student_class/class_infor/class_discuss.vue')
const ads = () => import('../views/manager/ads/ads.vue')

/* 教师界面路由
修改人：曾俊达
时间：2020/6/22 */

const class_video = () => import('../views/teacher/manage_class/class_video.vue')
const teacher = () => import('../views/teacher/teacher.vue')
const create_class = () => import('../views/teacher/create_class/create_class.vue')
const manage_class = () => import('../views/teacher/manage_class/manage_class.vue')
const manage_student = () => import('../views/teacher/manage_student/manage_student.vue')
const work_score = () => import('../views/teacher/manage_student/work_score.vue')
const classdetail = () => import('../views/teacher/manage_class/classdetail.vue')
const class_tree = () => import('../views/teacher/manage_class/class_tree.vue')
const tree_father = () => import('../views/teacher/manage_class/tree_father.vue')
const tree_child= () => import('../views/teacher/manage_class/tree_child.vue')
const tree_wrok= () => import('../views/teacher/manage_class/tree_work.vue')
const teacher_discuss= () => import('../views/teacher/manage_class/teacher_discuss.vue')
const teacher_discuss_menu = () => import('../views/teacher/discuss/teacher_discuss_menu.vue')
const teacher_discuss_content = () => import('../views/teacher/discuss/teacher_discuss_content.vue')
const teacher_discuss_answer = () => import('../views/teacher/discuss/teacher_discuss_answer.vue')
const teacher_discuss_appraise = () => import('../views/teacher/discuss/course_appraise.vue')
/* 学生界面
  修改人： 史天航、王炯森、张家豪
  时间：2020年6月27日*/
const student = () => import('../views/student/student.vue')
const student_page = () => import('../views/student/page-student/page.vue')
const class_page = () => import('../views/student/student_class/class_page.vue')
const study_work = () => import('../views/student/student_study/study_work.vue')
const study_discuss = () => import('../views/student/student_study/study_menu/study_discuss.vue')
const study_grade = () => import('../views/student/student_study/study_menu/study_grade.vue')
const study_homework = () => import('../views/student/student_study/study_menu/study_homework.vue')
const study_start = () => import('../views/student/student_study/study_menu/study_start.vue')
const discuss_menu = () => import('../views/student/student_study/study_menu/discuss_menu.vue')
const discuss_content = () => import('../views/student/student_study/study_menu/discuss_content.vue')
const discuss_answer = () => import('../views/student/student_study/study_menu/discuss_answer.vue')
const myClass = () => import('../views/student/page-student/myClass.vue')
const find_class = () => import('../views/student/student_class/find_class.vue')


Vue.use(VueRouter)

  const routes = [
    /* 管理员界面路由
  修改人：张家豪
  时间：2020/6/23 */
    {
      path: '/',
      name: 'Login',
      component: Login
    },
    {
      path: '/class/video',
      name: 'class_video',
      component: class_video
    },
    {
      path: '/Admin',
      name: 'Admin',
      component: Admin,
      children:[{
          path: '/manager/class',
          name: 'classmanager',
          component:classmanager  
        },{
          path: '/apply/class',
          name: 'classapply',
          component:classapply  
        },{
          path: '/control/user',
          name: 'usercontrol',
          component:usercontrol 
        },
        {
          path: '/control/ads',
          name: 'ads',
          component:ads 
        }
      ]
    },
    {
      path: '/test',
      name: 'Test',
      component: Test
    },
    /* 教师界面路由
    修改人：曾俊达
    时间：2020/6/22 */
    {
      path: '/teacher',
      name: 'teacher',
      component: teacher,

      children: [{
          path: '/create_class',
          name: 'create_class',
          component: create_class
        },
        {
          path: '/manage_class',
          name: 'manage_class',
          component: manage_class
        },
        {
          path: '/teacher/infor',
          name: 'teacher_infor',
          component: teacher_infor
        },
        {
          path: '/teacher/alter',
          name: 'teacher_alter',
          component: teacher_alter
        },
        {
          path: '/classdetail',
          name: 'classdetail',
          component: classdetail,
          children:[
            {
              path: '/work/score',
              name: 'work_score',
              component: work_score
            },
            {
              path: '/manage/student',
              name: 'manage_student',
              component: manage_student
            },
            {
            path:'/class/tree',
            name: 'class_tree',
            component: class_tree,
            children:[{
              path:'/tree/child',
              name: 'tree_child',
              component: tree_child,
            },
            {
              path:'/tree/father',
              name: 'tree_father',
              component: tree_father,
            },
            {
              path:'/tree/work',
              name: 'tree_wrok',
              component: tree_wrok,
            }]
          },
          {
            path:'/teacher/discuss',
            name: 'teacher_discuss',
            component: teacher_discuss,
            children:[{
              
                path: '/teacher/discuss/',
                name: 'teacher_discuss_menu',
                component: teacher_discuss_menu
              
            },
            {
              path: '/teacher/discuss/content',
              name: 'teacher_discuss_content',
              component: teacher_discuss_content
            },
            {
              path: '/teacher/discuss/answer',
              name: 'teacher_discuss_answer',
              component: teacher_discuss_answer
            },
            
           ]
          },
          {
            path: '/teacher/course/appraise',
            name: 'teacher_discuss_appraise',
            component: teacher_discuss_appraise
          }]
        },
      
       
      ]

    },
    /* 学生界面
    修改人： 史天航、王炯森、张家豪
    时间：2020年6月27日*/
    {
      path: '/student',
      name: 'student',
      component: student,
      children:[
        {
          path: '/student/class_check',
          name: 'class_check',
          component: class_check,  
          children:[
            {
              path: '/student/class_check/',
              name: 'class_content',
              component: class_content, 
            },
            {
              path: '/student/class_discuss',
              name: 'class_discuss',
              component: class_discuss, 
            }
          ]
        },{
        path: '/student/page',
        name: 'student_page',
        component: student_page  
      },
      {
        path: '/my/class',
        name: 'myClass',
        component: myClass  
      },
      {
        path: '/find/class',
        name: 'find_class',
        component: find_class
      }
      ,{
        path: '/study/work',
        name: 'study_work',
        component: study_work,
        children:[
          {
            path: '/study/grade',
            name: 'study_grade',
            component:study_grade 
          },
          {
            path: '/study/discuss',
            name: 'study_discuss',
            component:study_discuss, 
            children:[{
              path: '/study/discuss/',
              name: 'discuss_menu',
              component: discuss_menu
            },
            {
              path: '/discuss/content',
              name: 'discuss_content',
              component: discuss_content
            },
            {
              path: '/discuss/answer',
              name: 'discuss_answer',
              component: discuss_answer
            } 
          ]
          },
          {
            path: '/study/homework',
            name: 'study_homework',
            component:study_homework 
          },
          {
            path: '/study/work/',
            name: 'study_start',
            component:study_start 
          }
        ]  
      },{
        path: '/class/page',
        name: 'class_page',
        component:class_page,
        children:[{
          path: '/student/infor',
          name: 'student_infor',
          component: student_infor  
        },{
          path: '/student/alter_password',
          name: 'alter_password',
          component: alter_password  
        }]
      }]
    },
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router